1 using UnityEngine;
2 using
System.Collections;
3
4 namespace
Settings
5 {
6     
public class SettingLayer : MonoBehaviour
7     {
8         
public GameObject blackScreen;
9         
public GameObject infoLayer;
10         
public GameObject setLayer;
11
12         
public void Start()
13         {
14             
15         }
16
17         
public void Update()
18         {
19             
if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Backspace))
20             {
21                 
if (InputController.Name == InputNames.DIALOG)
22                 {
23                     
if (setLayer.activeSelf)
24                     {
25                         setVisibled(
false, false);
26                         InputController.Name = InputNames.MAINMENU;
27                     }
28                     
else
29                     {
30                         setLayer.SetActive(
true);
31                         infoLayer.SetActive(
false);
32                     }
33                 }
34             }
35         }
36
37         
public void setVisibled(bool isVisibled, bool bsVisible)
38         {
39             
if (isVisibled)
40             {
41                 blackScreen.SetActive(bsVisible);
42                 gameObject.AddComponent<Actor>().addAction(
new ActionMoveTo(0, 0, 0.5f, Interpolation.swingOut));
43                 gameObject.SetActive(
true);
44             }
45             
else
46             {
47                 blackScreen.SetActive(bsVisible);
48                 
if (gameObject.GetComponent<Actor>() != null)
49                     Destroy(gameObject.GetComponent<Actor>());
50                 transform.localPosition =
new Vector3(transform.localPosition.x, 4.8f, transform.localPosition.z);
51                 gameObject.SetActive(
false);
52             }
53         }
54
55     }
56 }



Trò chơi đua xe động vật trong UNITY Engine 114.676 lượt xem

Gõ tìm kiếm nhanh...